    
if (typeof (_trackingReceive) == 'undefined') {
    var _trackingReceive = false;
}
var _admReceiveTime = 0;
function checkViewStats() {

    if ((window.document.readyState == 'complete') || (typeof (window.document.readyState) == 'undefined')) {
        if (!_trackingReceive) {
            _trackingReceive = true;
            processData();
        }
    }
    else {
        _admReceiveTime++;
        if (_admReceiveTime == 5) {
            if (!_trackingReceive) {
                _trackingReceive = true;
                processData();
            }
            return false;
        }
        setTimeout("checkViewStats()", 1000);
    }
}
checkViewStats();


function processData() {
    var _url = ""
    if ($j.browser.msie && parseInt($j.browser.version, 10) <= 7) {
        _result = true;
    }

    // IE only Cross domain JSON GET request
    else if ('XDomainRequest' in window && window.XDomainRequest !== null) {
        // Use Microsoft XDR
        var xdr = new XDomainRequest();
        xdr.open("get", _url + '?id=' + 9808 +'&f=' + 1);
        xdr.onload = function () {
            var dom  = new ActiveXObject("Microsoft.XMLDOM"),
                JSON = $j.parseJSON(xdr.responseText);

            dom.async = false;

            if (JSON == null || typeof (JSON) == 'undefined') {
                JSON = $j.parseJSON(data.firstChild.textContent);
            }

            preview(JSON); // internal function
        };

        xdr.onerror = function() {
            _result = false;  
        };

        xdr.send();
    } 

    else {
        $j.ajax({
            url: _url,
            cache: false,
            dataType: 'json',
            type: 'GET',
            async: false, // must be set to false
            data: { id : "9808", f : "1"},
            success: function (data) {
                preview(data);
            },
            error: function () {
                
            }
        });
    }

}

function preview(data){
    var preview = new Preview(data);
    preview.print();
}